<template>
    <div>
        <el-row>
            <el-tabs
                v-model="activeTab"
                type="card"
            >
                <el-tab-pane
                    label="基本信息"
                    name="tabBase"
                >
                    <base-info
                        ref="baseInfoForm"
                        :isAdvancedSetting="isAdvancedSetting"
                        :diagnosis="diagnosis"
                    ></base-info>
                </el-tab-pane>
                <el-tab-pane
                    label="病理信息"
                    name="tabPathologyInfo"
                >
                    <pathology-info :diagnosis="diagnosis"></pathology-info>
                </el-tab-pane>
                <el-tab-pane
                    v-if="isMatched"
                    label="病理切片"
                    name="tabPathologyList"
                >
                    <span slot="label">病理切片
                        <el-badge
                            v-if="diagnosis.biopsyList.length > 0"
                            :value="diagnosis.biopsyList.length"
                            class="tab-content-badge"
                        ></el-badge>
                    </span>
                    <pathology-list :biopsyList="diagnosis.biopsyList"></pathology-list>
                </el-tab-pane>
                <!-- <el-tab-pane label="附件资料" name="tabAttachment">
                    <attachment :data="diagnosis.attachment"
                                :diagnosis-id="diagnosis.id"></attachment>
                </el-tab-pane> -->
            </el-tabs>
        </el-row>
    </div>
</template>

<script>
import diagnosisDefault from '@templates/diagnosisDefault';
import BaseInfo from './DiagnosisMatchDetailBase';
import PathologyInfo from './DiagnosisMatchDetailPathologyInfo';
import PathologyList from './DiagnosisMatchDetailPathologyList';
import Attachment from './DiagnosisMatchDetailAttachment';

export default {
    name: 'DiagnosisMatchDetail',
    components: {
        BaseInfo,
        PathologyInfo,
        PathologyList,
        Attachment,
    },
    props: {
        // 是否展开高级诊断设置
        isAdvancedSetting: {
            type: Boolean,
            default: false,
        },
        diagnosis: {
            type: Object,
            default: diagnosisDefault,
        },
    },
    data() {
        return {
            activeTab: 'tabBase',
        };
    },
    computed: {
        isMatched() {
            return !!this.diagnosis.currentLevel;
            console.log('this.diagnosis', this.diagnosis);
        },
    },
    methods: {
        validateForm(formName) {
            console.log(
                'formName',
                formName,
                this.$refs[formName].validateForm()
            );
            return this.$refs[formName].validateForm();
        },
    },
};
</script>

<style scoped>
</style>
